<?php

function smarty_function_get_subcategory ($params, &$smarty) {

  $cat_id = $params['cat_id'];
    $pntables = pnDBGetTables();

  if(isset($cat_id)){
    //Query type data
    $sql = "SELECT
              sct_id,
              sct_name
            FROM ".
              $pntables[innoadvert_subcategories]
            ." WHERE
              sct_categories_id = ".$cat_id;

    $column = array("id","name");
    $result = DBUtil::executeSQL($sql);
    $objectArray = DBUtil::marshallObjects ($result, $column);
    $smarty->assign("subcategories_name", $objectArray);
  }

}
